package com.sws.orderMS.command.impl;

import com.sws.orderMS.OrderMSApplication;
import com.sws.orderMS.command.SystemCommand;
import com.sws.orderMS.pojo.Client;
import com.sws.orderMS.pojo.Manager;
import com.sws.orderMS.pojo.User;
import com.sws.orderMS.tool.Tool;

public class HelpCommand extends SystemCommand {

	private static StringBuilder help;
	private static StringBuilder help4sys;
	private static StringBuilder help4user;
	
	static {
		help = new StringBuilder("This is the usage for Order Management System:\n");
		help.append("exit            - Exit").append("\n");
		help.append("help            - Print usage").append("\n");
		help.append("login           - Login the application").append("\n");
		help.append("signup          - Sign up an player accounter").append("\n");
		
		help4sys = new StringBuilder("This is the usage for Order Management System:\n");
		help4sys.append("exit            - Exit").append("\n");
		help4sys.append("help            - Print usage").append("\n");
		help4sys.append("login           - Login the application").append("\n");
		help4sys.append("signup          - Sign up an user accounter").append("\n");
		help4sys.append("user_manage     - Manage users for ADD|DELETE|UPDATE|LIST").append("\n");
		help4sys.append("product_manage  - Manage products for ADD|DELETE|UPDATE|LIST").append("\n");
		help4sys.append("order_manage    - Manage orders for ADD|DELETE|UPDATE|LIST").append("\n");
		
		help4user = new StringBuilder("This is the usage for Order Management System:\n");
		help4user.append("exit            - Exit").append("\n");
		help4user.append("help            - Print usage").append("\n");
		help4user.append("login           - Login the application").append("\n");
		help4user.append("signup          - Sign up an player accounter").append("\n");
		help4user.append("list_product    - List products for ALL|NAME|TYPE|CODE").append("\n");
		help4user.append("order           - order product").append("\n");
		help4user.append("pay             - Pay for a order").append("\n");
		help4user.append("list_my_order   - List my order for ALL|PRODUCT|DONE|UNDONE").append("\n");
		help4user.append("recharge        - Recharge personal account").append("\n");
		help4user.append("modify          - Modify personal infomation").append("\n");
	}
	@Override
	public void execute() {
		User user = OrderMSApplication.getInstance().getUserProfile();
		if (user == null) {
			Tool.printMsg(help.toString());
		} else if (user instanceof Manager) {
			Tool.printMsg(help4sys.toString());
		} else if (user instanceof Client) {
			Tool.printMsg(help4user.toString());
		}
	}

}
